#ifndef __FORMPOST_H__
#define __FORMPOST_H__
#include <QString>
#include <QStringList>
#include <QByteArray>
#include <QFile>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>

/*	
	FormPost.h

	FormPost pp;
	pp.addField("name","asdf@##!@#&!@#&as");
	QString qsRet =QString::fromUtf8(pp.postData("http://tracker.xfreesoft.com/test.php"));
*/

class FormPost : QObject
{ 
	Q_OBJECT

public:
	FormPost();
	QString userAgent();
	void setUserAgent(QString agent);
	QString referer();
	void setReferer(QString ref);
	QString encoding();
	void setEncoding(QString enc);
	void addField(QString name, QString value);
	void addFile(QString fieldName, QByteArray file, QString name, QString mime);
	void addFile(QString fieldName, QString fileName, QString mime);
	QByteArray postData(QString url);

private:
	QByteArray data;
	QByteArray strToEnc(QString s);
	QString encodingS;
	QString userAgentS;
	QString refererS;
	QStringList fieldNames;
	QStringList fieldValues;
	QStringList fileFieldNames;
	QStringList fileNames;
	QStringList fileMimes;
	QList<QByteArray> files;
};

#endif 
